﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Selen.TypeBrowser.VsIntegration;
using System.ComponentModel;
using Microsoft.CSharp;
using System.CodeDom;

namespace Ebc.DesignerDsl.TypeBrowserIntegration
{
    public class TypeDefinitionEditor : VisualStudioIntegratedTypeBrowserEditor
    {
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            var typeDef = value as TypeDefinition;
            var newValue = base.EditValue(context, provider, null) as Type;

            if (newValue != null)
            {
                typeDef.SetType(newValue);
            }

            return typeDef;
        }
    }
}